import React, { useEffect, useState } from "react";
import { Button, Space, Table, Tag } from "antd";
import type { TableProps } from "antd";
import { lbapi } from "../../hook/useRequest";
let Index: React.FC = () => {
  interface DataType {
    key: string;
    name: string;
    age: number;
    address: string;
    tags: string[];
  }
  let [data,setdata]=useState()
  let [page, setpage] = useState(1);
  let [pageSize, setpageSize] = useState(10);
  let fun = () => {
    lbapi({ page, pageSize }).then((res) => {
      console.log("lb", res);
      setdata(res.data.rows)
    });
  };
  useEffect(() => {
    fun();
  }, []);

  const columns: TableProps<DataType>["columns"] = [
    {
      title: "ID",
      dataIndex: "id",
      key: "id",
    },
    {
      title: "标题",
      dataIndex: "title",
      key: "title",
    },
    {
      title: "办理日期",
      dataIndex: "createdAt",
      key: "createdAt",
    },

    {
      title: "操作",
      key: "action",
      render: (_, record) => (
        <Space size="middle">
          <Button>修改</Button>
        </Space>
      ),
    },
  ];
  return (
    <div>
      <Table<DataType> columns={columns} dataSource={data} rowKey='id' />
    </div>
  );
};

export default Index;
